public class demo {
    public ListNode reverseList(ListNode head) {
        if(head==null||head.next==null)return head;
        ListNode nhead= reverseList(head.next);
       head.next.next=head;
       head.next=null;
        return nhead;
    }
}

